package com.dts.backproject.entity.po;

import lombok.Data;

@Data
public class Result<T> {
    private Integer code;
    private T data;
    private String msg;

    public void setCode(Integer code) {
        this.code = code;
    }

    public void setData(T data) {
        this.data = data;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static Result success(){
        Result result = new Result();
        result.setCode(200);
        return result;
    }

    public static Result success(Object data){
        Result result = new Result();
        result.setCode(200);
        result.setData(data);
        return result;
    }

    public static Result success(String msg){
        Result result = new Result();
        result.setCode(200);
        result.setMsg(msg);
        return result;
    }

    public static Result error(String msg){
        Result result = new Result();
        result.setCode(500);
        result.setMsg(msg);
        return result;
    }
}